package com.clkj.xiuzheng.dao;

import com.clkj.xiuzheng.pojo.Shop;
import com.clkj.xiuzheng.pojo.UserShopApply;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @author yawang
 * @create 2024/04/11 13:47:14
 **/
@Repository
public interface ShopMapper extends Mapper<Shop> {

    @Select("SELECT  * FROM t_cl_shop where shop_region = #{shopRegion} ORDER BY NEWID() ")
    List<Shop> listShopsByNewId(@Param("shopRegion")Integer shopRegion);

    @Select("select shop_region,count(*) as shop_dayNum from t_cl_shop group by shop_region")
    List<Shop> listShopNum();

    @Select("select shop_region,count(*) as shop_dayNum from t_cl_shop where shop_advert !='' group by shop_region")
    List<Shop> listShopAdv();

    @Select("select shop_region,count(*) as shop_dayNum from t_cl_shop where shop_advert  ='' group by shop_region")
    List<Shop> listShopUnAdv();

    @Select("select shop_region,count(shop_advert) as shop_dayNum,shop_advert from t_cl_shop where shop_advert  !='' group by shop_region,shop_advert order by shop_region")
    List<Shop> listShopAdvNum();

    @Select("select count(*) as shop_dayNum, shop_advert from t_cl_shop where shop_advert  !='' group by shop_advert")
    List<Shop> listAdvNum();



    @Update("update t_cl_shop set shop_status = 2 where shop_id in (select shop_id from t_cl_userPut where record_id = #{recordId})")
    void updateShopStatus(@Param("attach")String attach);



}
